<?
function getCampiCond() {
   $aDefCampi = getDefCampi("ovf_anagrafiche");
   $aCampiPar = array(""=>"-- campo --");
   foreach($aDefCampi as $campo =>$aDef) {
      $aCampiPar['A.'.$campo] = $campo;         
   }
   return $aCampiPar;
}

function getEsitoRic($sWhere, &$sHtml, &$sMess) {
   global $objDB, $objSess;
   $sql_sel = "SELECT count(*) AS num_rec " .
         " FROM ovf_anagrafiche A " .$sWhere;
   //dbg_($sql_sel); 
   $objDB->query($sql_sel,'selRec');
   $acRec = $objDB->fetch('selRec');
   $numRec = $acRec['num_rec'];
   $link = $_SERVER['PHP_SELF']."?xsn=".XSN;
   $startOffset = 0;
   $endOffset = 0;
   $sPaginaz = ovfGetPaginaz($link, $numRec, $startOffset, $endOffset);
   
   $sql_sel = "SELECT A.id_anag, A.cod_anag, A.intestaz1 " .
         " FROM ovf_anagrafiche A " .$sWhere.
         " ORDER BY A.intestaz1, A.id_anag ".
         " LIMIT ".$startOffset.",".($endOffset-$startOffset);
   $objDB->query($sql_sel,'selRec');
   $sHtml = "";
   $sHtml .= "<tr><td class=\"cmd1\" align=\"right\" colspan=\"20\">$sPaginaz</td></tr>\n";
   $sHtml .= "<tr><td class=\"tit1\" align=\"center\" colspan='20'>Esito ricerca</td></tr>\n";
   $clRF = 'txt2';
   while($acX = $objDB->fetch('selRec')) { 
      $clRF = ($clRF=='txt1')?'txt2':'txt1'; 
      $sHref = OVF_URL_ROOT."/app/rcom/anag/anagView.php?idAnag=".$acX['id_anag']."&xsn=".XSN;
      $sHtml .= "<tr>\n";
      $sHtml .= "<td class='$clRF' align='right' colspan='1'><a class='$clRF' href='$sHref'>".$acX['id_anag']."</a></td>\n";
      $sHtml .= "<td class='$clRF' align='left' colspan='3'><a class='$clRF' href='$sHref'>".$acX['cod_anag']."</a></td>\n";
      $sHtml .= "<td class='$clRF' align='left' colspan='16'>".$acX['intestaz1']."</td>\n";
      $sHtml .= "</tr>\n";
   } 
   $sHtml .= "<tr><td class=\"cmd1\" align=\"right\" colspan=\"20\">$sPaginaz</td></tr>\n";
   return true;
}
